--
-- Author: yawei.zhu
-- Date: 2019-02-13 15:38:05
--
-- NewWildBossInfoView
--

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

local IconRender = require("app.widget.renders.IconRender")
local drops = {630065, 630050, 630030}
local dropDescs = {L("lua_code_text_17"), L("lua_code_text_17"), L("lua_code_text_17")}

ClassRef.VIEW_ROOT_RES = Res.NewWorldBossInfoScene

function ClassRef:init()
	self._ui.Button_close:addClickEventListener(function()
		executeFunc(self._onCloseView, self)
	end)

	self._tltText = self._ui["Panel/Panel_left/tlt"] -- 副本名字
	self._descText = self._ui["Panel/Panel_left/Text"] -- 副本说明
	self._icon = self._ui["Panel/Panel_left/Image"] -- 副本底图
	self._ruleText = self._ui["Panel/Panel_right/Panel_text/text"] -- 规则说明文本
	self._tipText = self._ui["Panel/Panel_right/tips"] -- 右侧下方文本
end

-- 设置玩法名字
function ClassRef:setDungeonName(nameStr)
	nameStr = nameStr or ""
	self._tltText:setString(nameStr)
end

function ClassRef:refresh(data)
	local eventModeConf = GD:queryEventModeById( data )
	if not eventModeConf then
		print( " ------------------>>> 找不到event_mode表中内容", data )
		return
	end
	local iconBgPath = GD:getImagePath( Res.teamtarget_pic, eventModeConf.eventBg)
	self._icon:loadTexture( iconBgPath )

	self._descText:setString( L(eventModeConf.eventTips) )
	self._ruleText:setString( L(eventModeConf.eventDes) )
	self._tipText:setString(L("wildbossboxrule"))

	for i = 1, 3 do 
		local icon = self._ui["Panel/Panel_right/Panel_item/Panel_" .. i .. "/icon"]
		local render = IconRender.create(icon)
		local itemDatas = UD:parseDropIDToBagItem(drops[i])
		render:setTipEnable(true)
		render:setData(itemDatas[1])

		local desc = self._ui["Panel/Panel_right/Panel_item/Panel_" .. i .. "/name"]
		desc:setString(dropDescs[i])
	end
end

return ClassRef
